<?php echo $this->render('/public/header');?>
<?php use yii\helpers\Url;?>
<div class="col-xs-12" id="main">
	<table class="table table-borderd">
		<thead>
			<tr>
				<th>咨询时间</th>
				<th>国家</th>
				<th>email</th>
				<th>询盘内容</th>
				<th>认领询盘</th>
			</tr>
		</thead>
		<?php if($this->params['list']){?>
		<?php foreach ($this->params['list'] as $k => $v) { ?>
		<tr>
			<td><?php echo date('Y-m-d H:i:s',$v['consultation_time']);?></td>
			<td><?php echo $v['country'];?></td>
			<td><?php echo $v['email'];?></td>
			<td><?php echo $v['inquiry_detail'];?></td>
			<td><button class="layui-btn layui-btn-danger" onclick="get_inquiry(<?php echo $v['id'];?>)">认领询盘</button></td>
		</tr>
		<?php } ?>
		<?php } ?>
	</table>
	<div id="page"></div>
</div>
<script>
	layui.laypage({
		cont: 'page' 
		,pages: <?php echo $this->params['page']['page'];?>
		,curr:<?php echo $this->params['page']['curr'];?>
		,skin: '#5FB878'
		,skip: true 
		,jump: function(obj, first){
			if(!first){
				window.location.href="<?php echo $this->params['page']['base_url'];?>?p="+obj.curr;
			}
		}
	});
	function get_inquiry(v)
	{
		if(layer.confirm('确认认领此询盘',{},function(){
			var url = "<?php echo Url::to('/sell/inquiry_update_job_number');?>";
			$.post(url,{id:v},function(res){
				layer.confirm(res.msg,{},function(){
					window.location.reload();
				})
			},'json')
		}

		));
	}
</script>
<?php echo $this->render('/public/footer');?>